import axi from 'axios';

export default {
  detail(p) {
    return axi.get(`/bpaper/detail/${p}`, {
      params: p,
      headers: {
        Authorization: `Bearer ${sessionStorage.getItem('userToken')}`,
      },
    });
  },
  getComment(p) {
    return axi.get('/bcomment/queryBComments', {
      params: p,
      headers: {
        Authorization: `Bearer ${sessionStorage.getItem('userToken')}`,
      },
    });
  },
  addByUserId(p) {
    return axi.post('/bcomment/addByUserId', p, {
      headers: {
        Authorization: `Bearer ${sessionStorage.getItem('userToken')}`,
      },
    });
  },
  updateSelf(p) {
    return axi.put('/bpaper/updateSelf', p, {
      headers: {
        Authorization: `Bearer ${sessionStorage.getItem('userToken')}`,
      },
    });
  },
  update(p) {
    return axi.put('/bpaper/update', p, {
      headers: {
        Authorization: `Bearer ${sessionStorage.getItem('userToken')}`,
      },
    });
  },

  queryDB(p) {
    return axi.get('/bquestiondb/queryBQuestionDbs', {
      params: p,
      headers: {
        Authorization: `Bearer ${sessionStorage.getItem('userToken')}`,
      },
    });
  },
  self(p) {
    return axi.post('/bpaper/self', p, {
      headers: {
        Authorization: `Bearer ${sessionStorage.getItem('userToken')}`,
      },
    });
  },
};
